const { query } = require("./mysql");
const { handelPointByAirLine } = require("./handle/access");

(async function () {
  const res = await query(`SELECT * FROM flight_airline WHERE StartAirportName LIKE '%沈阳%' OR EndAirportName like "%沈阳%"`);
  for (let item of res) {
    const a = await handelPointByAirLine(item);
    console.log(a);
  }
  //   const res = await query(`select AirwayName,StartPointName,EndPointName from flight_airline_point where FLIGHT_AIRLINE_ID = '2f6d4bb5-de47-4c55-bd01-4dc0e5c49262'`);

  //   const points = [res[0]];
  //   for (let i = 1; i < res.length; i++) {
  //     const lastPoint = points[points.length - 1];
  //     const thisPoint = res[i];

  //     if (lastPoint.AirwayName == thisPoint.AirwayName) {
  //       lastPoint.EndPointName = thisPoint.EndPointName;
  //     } else {
  //       points.push(thisPoint);
  //     }
  //   }
  //   console.log(points);
})();
